package com.example.mapper.news;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.domain.news;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface newsQuery extends BaseMapper<news> {

    @Select("select * from news where userid=${openid}")
    List<news> findnews(String openid);

    @Select("select news.id as id,news.type as type,news.xiaoxi as xiaoxi,news.time as time,`user`.`name` as userid FROM news,`user` WHERE news.userid=`user`.openid AND `user`.`name` LIKE ${name} limit ${a},${b}")
    List<news> selectall(int a,int b,String name);
    @Select("select COUNT(*) FROM news")
    int num();
}
